package database.demo;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class DataBaseWrapperImportant extends SQLiteOpenHelper {

	public static final String IMPORTANT = "Important";
	public static final String IMPORTANT_ID = "_id";
	public static final String IMPORTANT_NAME = "_name";
	public static final String IMPORTANT_ROLE = "_role";
	public static final String IMPORTANT_PHONE = "_phone";
	public static final String IMPORTANT_EMAIL = "_email";
	public static final String IMPORTANT_ADDRESS = "_address";


	private static final String DATABASE_NAME = "Important.db";
	private static final int DATABASE_VERSION = 1;

	// creation SQLite statement
	private static final String DATABASE_CREATE = "create table " + IMPORTANT
			+ "(" + IMPORTANT_ID + " text primary key, " + IMPORTANT_NAME
			+ " text, " + IMPORTANT_ROLE + " text, " + IMPORTANT_PHONE
			+ " text, " + IMPORTANT_EMAIL + " text, " + IMPORTANT_ADDRESS
			+ " text" + ");";

	public DataBaseWrapperImportant(Context context) {
		super(context, DATABASE_NAME, null, DATABASE_VERSION);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		// db.execSQL("DROP TABLE IF EXISTS " + PASSANGERS);
		db.execSQL(DATABASE_CREATE);
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		// you should do some logging in here
		// ..
		db.execSQL("DROP TABLE IF EXISTS " + IMPORTANT);
		onCreate(db);
	}

}